package ch.drshit.model.filter;

import java.awt.Color;

import ch.drshit.model.picture.Options;
import ch.drshit.model.picture.Version;

public class SchwarzWeissFilter extends BaseFilter{
	public SchwarzWeissFilter(FilterListener l, Version v) {
		super(l, v);
	}
	
	
	@Override
	public void startFilter(Options options) {
		Version v = this.getVersion();
		Color[][] image = v.getColorArray();
		float prozent = 0;
		float imagelength = (float) image.length;
		for(int i=0;i<image.length;i++){
			prozent = (float)i / imagelength * 100f;
			this.getListener().filterStatusChanged((int)prozent);
			for(int r=0;r<image[i].length;r++){
				image[i][r] = grey(image[i][r]);
			}
		}
		v.setArray(image);
		this.getListener().result();
	}
	
	@Override
	protected Options getFilterOptions() {
		return new Options();
	}
	
}
